package com.sdtw.bookshop.shop.controller;

import com.sdtw.bookshop.shop.bean.BookTypeInfo;
import com.sdtw.bookshop.shop.service.BookClassService;
import com.sdtw.bookshop.shop.service.BookKindService;
import com.sdtw.bookshop.shop.service.BookTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
//@RequestMapping("type")
public class BookTypeController {
    @Autowired
    private BookTypeService bookTypeService;
    @Autowired
    private BookClassService bookClassService;
    @Autowired
    private BookKindService bookKindService;
    //树形菜单数据
    //未使用此方法
    @RequestMapping(value = "findaaaa", produces = {"application/json;charset = utf-8"})
    public String find(Model model,Model mv1,Model mv2){
        model.addAttribute("MENU",bookTypeService.find());
        mv1.addAttribute("BOOKCLASS",bookClassService.findAll());
        mv2.addAttribute("BOOKKIND",bookKindService.findAll());
        return "merchandiseList.htm";//List<BookTypeInfo>
    }
    @RequestMapping(value = "findmenu", produces = {"application/json;charset = utf-8"})
    public String findmenu(Model model,Model mv1,Model mv2){
        model.addAttribute("MENU",bookTypeService.find());
        mv1.addAttribute("BOOKCLASS",bookClassService.findAll());
        mv2.addAttribute("BOOKKIND",bookKindService.findAll());
        return "merchandiseList.htm";//List<BookTypeInfo>
    }
}
